//
//  YCTextView.h
//  YCTextView
//
//  Created by Hychen on 16/7/7.
//  Copyright © 2016年 Hychen. All rights reserved.
//

#import <UIKit/UIKit.h>
@class YCTextView;

/*
 [self.textView mas_makeConstraints:^(MASConstraintMaker *make) {
 make.left.equalTo(self.view).offset(15);
 make.centerX.equalTo(self.view);
 make.top.equalTo(self.view).offset(15);
 make.height.equalTo(@100);
 }];
 self.textView.font = [UIFont systemFontOfSize:15];
 self.textView.layer.borderWidth = 1;
 self.textView.layer.borderColor = [UIColor colorWithRed:122/255.0 green:122/255.0 blue:122/255.0 alpha:1].CGColor;
 self.textView.layer.cornerRadius = 8;
 self.textView.delegate = self;
 // 必须重写,否则报错
 [self.textView setLimitTextLengthBlock:^{
 
 }];
 */

typedef enum{
    LimitStyleResidue, //只显示剩余文字个数
    LimitStyleExistAndAll //显示已输入个数和总数
}LimitStyle;

@protocol YCTextViewDelegate <UITextViewDelegate>

// 监听输入框内的文字变化
- (void)YCTextView:(YCTextView *)YCTextView textDidChanged:(NSString *)text;

@end

@interface YCTextView : UITextView

/** 占位文字 */
@property (nonatomic, copy) NSString *placeholder;

/** 占位文字颜色 */
@property (nonatomic, strong) UIColor *placeholderColor;

/** 占位文字的起始位置 */
@property (nonatomic, assign) CGPoint placeholderLocation;

/** textView是否可伸长 */
@property (nonatomic, assign) BOOL isCanExtend;

/** 伸长限制行数 */
@property (nonatomic, assign) NSUInteger extendLimitRow;

/** 默认底部增加高度(默认为20,留出提示文字个数的距离) */
@property (nonatomic, assign) NSInteger moreHeight;

/** 限制文本长度数 会自动显示出个数 */
@property(nonatomic, assign)int limitTextLength;

/** 文字提示风格 */ //赋值要在limitTextLength之前
@property (nonatomic, assign) LimitStyle limitStyle;

/** 限制文本长度label文字颜色 */
@property(nonatomic, strong)UIColor *limitTextLengthLabelTextColor;

/** 文本超出限制的回调 */
@property(nonatomic, copy)void(^limitTextLengthBlock)();


@property (nonatomic, weak) id<YCTextViewDelegate> delegate;

@end
